<?xml version="1.0" encoding="UTF-8" ?>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" media="all" href="resources/css/game.css" />
<script type="text/javascript" src="resources/js/game.js"></script>
<script type="text/javascript" src="resources/js/ajaxHandler.js"></script>
	<title>Mancala Score board</title>
</head>

<body>
	
<jsp:useBean id="player" class="com.uzletiwebtech.mancala.User" scope="session"></jsp:useBean>
<jsp:setProperty name="player" property="*" />
<c:if test="${empty player.fullName }">
	<jsp:forward page="CommonServlet" />
</c:if>

<p>
	<c:choose>
		<c:when test="${((empty param.winner) || (empty param.time) || (empty param.coins))}">
			<jsp:forward page="CommonServlet" />
		</c:when>
		<c:when test="${param.winner == 'player'}">
			<c:out value="${player.fullName}"></c:out>
			won, gained coins: <c:out value="${param.coins}"></c:out>
		</c:when>
		<c:when test="${param.winner == 'computer'}">
			Computer won, you lose!
			Gained coins: <c:out value="${param.coins}"></c:out>
		</c:when>
		<c:when test="${param.tie == 'true'}">
			It is a tie! Gained coins: <c:out value="${param.coins}"></c:out>
		</c:when>
		<c:otherwise>
			<jsp:forward page="CommonServlet" />
		</c:otherwise>
	</c:choose>
	Elapsed time: <c:out value="${param.time}"></c:out>
</p>

</body>
</html>